<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>editMonitor</title>
    <script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
</head>
<body>
    <div th:fragment="editMonitor">
        <div style="padding:10px 20px 20px 20px">
            <form id="ff" method="post">
                <table >
                    <tr>
                        <td>监视对象Id:</td>
                        <td><input class="easyui-textbox " type="text" name="monitorobjId" readonly="true" style="background-color: #ddd"></input></td>
                    </tr>
                    <tr>
                        <td>监视对象名称:</td>
                        <td><input class="easyui-textbox" type="text" name="monitorobjName" data-options="required:true"></input></td>
                    </tr>
                    <tr>
                        <td>监视对象类型:</td>
                        <td>
                            <select class="easyui-combobox" name="monitorobjType" data-options="required:true">
                                <option value="webServiceAccess">web接口服务可访问性</option>
                                <option value="portAccess">端口可访问性</option>
                                <option value="ipAccess">ip可访问性</option>
                                <option value="databaseAccess">数据库可访问性</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>创建时间:</td>
                        <td><input class="easyui-textbox" type="datetime" name="creatTime" readonly="true" style="background-color: #ddd"></input></td>
                    </tr>
                    <tr>
                        <td>检测程序ID:</td>
                        <td>
                            <select id="monitorobjCodeId" class="easyui-combobox" name="monitorobjCodeId" data-options="required:true">
                                <option value="cscode">测试程序代码XXXXXXXXXXXXXXXXX</option>
                            </select>
                        </td>
                    </tr>
                </table>
            </form>
            <div style="text-align:center;padding:5px">
                <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">保存</a>
                <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">清空</a>
               <!-- <a href="javascript:void(0)" class="easyui-linkbutton" onclick="testsetvalue()">设置值</a>-->
            </div>
        </div>
        <script >
            //初始化monitorobjCodeId选择框
            $.ajax({
                url:'initMonitorobjCodeIdSele',
                method:"post",
                dataType: "json",
                success:function(data){
                    if(data.length==0){
                        //alert("没有可用的检测程序");
                        return
                    }
                    var seldata = [];
                    for (var i = 0; i < data.length; i++) {
                        seldata.push({ "text": data[i].monitorcodeDesc, "value": data[i].monitorcodeId });
                    }
                    $("#monitorobjCodeId").combobox("loadData", seldata);
                    console.log(seldata);
                },
                error:function(data){
                    console.log("初始化下拉框失败");
                },
            });
            //定义好form的相关处理
            $('#ff').form({
                url:"saveMonitorObj",
                success:function(data){
                    alert("保存成功！");
                    reloadGrid();
                    $('#editMonitorWin').dialog('close')
                }
            });
            function submitForm(){
                $('#ff').form('submit');
            }
            function clearForm(){
                $('#ff').form('clear');
            }
            function testsetvalue(){
                $('#ff').form('load',{
                    monitorobjId:"0000",
                    monitorobjName:"0000",
                    monitorobjType:"portAccess",
                });
            }
        </script>
    </div>
</body>
</html>
<script>



</script>
